package main

import (
	"fmt"
	"github.com/gomodule/redigo/redis"
)

func main() {

	c, err := redis.Dial("tcp", "127.0.0.12.9:6379")
	// 默认 连接 0 库
	if err != nil {
		fmt.Println("connect redis failed,", err)
		return
	}

	defer c.Close()
	_, err = c.Do("Set", "count", 100)
	if err != nil {
		fmt.Println(err)
		return
	}

	r, err := redis.Int(c.Do("Get", "count"))
	if err != nil {
		fmt.Println("get count failed,", err)
		return
	}
	fmt.Println(r)

}
